import { http } from "@/utils/http";

export const apiListTestcase = (data?: object) => {
  return http.request<Object>("post", "/api/testcase/list", { data });
};

export const apiEditTestcaseHeader = (data?: object) => {
  return http.request<Object>("post", "/api/testcase/updateHeader", { data });
};

export const apiAddTestcase = () => {
  return http.request<Object>("post", "/api/testcase");
};

export const apiDelTestcase = (filename?: string) => {
  return http.request<Object>("delete", "/api/testcase/" + filename);
};

export const apiInfoTestcase = (filename?: string) => {
  return http.request<Object>("get", "/api/testcase/" + filename, {responseType: "blob"});
};

export const apiExportTestcase = (filename?: string) => {
  return http.request<Object>("get", "/api/testcase/" + filename, {responseType: "blob"});
};

export const apiUploadContentTestcase = (data?: any) => {
  return http.request<Object>("post", "/api/testcase/updateContent", { data }, {
    headers: {
      "Content-Type": "multipart/form-data",
    }
  })
}

export const apiUploadTestcase = (data?: any) => {
  return http.request<Object>("post", "/api/testcase/upload", { data }, {
    headers: {
      "Content-Type": "multipart/form-data",
    }
  })
}